#include "mobilestoragewidget.h"

#include <QCheckBox>
#include <QScrollArea>
#include <QScrollBar>
#include <QDebug>

#include <kbreadcrumb.h>
#include "generatetools.h"

using namespace kdk;

const int CRUMB_MAXIMUM_WIDTH = 700;

MobileStorageWidget::MobileStorageWidget(const QMap<QString, FileInfo> &listStruct, QString tabBarPath, int index,
                                         QWidget *parent)
    : QWidget(parent)
{
    m_listStruct = listStruct;
    m_tabBarPath = tabBarPath;
    qInfo() << "listCount" << listStruct.size();
    qInfo() << "crumb path" << tabBarPath;
    if (index == FILE_TYPE::Search) {
        initSearchUI();
    } else if (index == FILE_TYPE::Pctopc) {
        initPcUI();
    } else if (index == FILE_TYPE::Mobile) {
        initUI();
    }
}

MobileStorageWidget::~MobileStorageWidget()
{
    if (m_mobileStorageViewWidget != nullptr) {
        delete m_mobileStorageViewWidget;
        m_mobileStorageViewWidget = nullptr;
    }
}

void MobileStorageWidget::setMode(QListView::ViewMode mode)
{
    m_mode = mode;
    switch (m_mode) {
    case QListView::ListMode:
        m_modeButton->setIcon(QIcon::fromTheme("view-list-symbolic"));
        m_modeButton->setToolTip(tr("Icon Mode")); // Icon Mode图标模式
        break;
    case QListView::IconMode:
        m_modeButton->setIcon(QIcon::fromTheme("view-grid-symbolic"));
        m_modeButton->setToolTip(tr("List Mode")); // List Mode列表模式
        break;
    default:
        break;
    }
    m_mobileStorageViewWidget->setMode(m_mode);
    Q_EMIT sigModeChange(m_mode);
}

void MobileStorageWidget::initUI()
{
    QVBoxLayout *mainVLayout = new QVBoxLayout();
    mainVLayout->setContentsMargins(0, 0, 0, 0);
    this->setLayout(mainVLayout);

    QHBoxLayout *fileListHLayout = new QHBoxLayout();

    m_copyButtonMobileStrorageWidget = new CopyToComputerButtonWidget(this);
    m_copyButtonMobileStrorageWidget->hide();

    QPushButton *retreatButton = new QPushButton(this);
    retreatButton->setIcon(QIcon::fromTheme("go-next-rtl-symbolic"));
    retreatButton->setFixedSize(16, 16);
    retreatButton->setFlat(true);
    retreatButton->setCursor(Qt::PointingHandCursor);

    //    QPushButton *forwardButton = new QPushButton(this);
    //    forwardButton->setIcon(QIcon::fromTheme("go-next-symbolic"));
    //    forwardButton->setFixedSize(16, 16);
    //    forwardButton->setFlat(true);
    //    forwardButton->setCursor(Qt::PointingHandCursor);

    QFont font;
    font.setBold(true);
    //面包屑
    KBreadCrumb *crumb = new KBreadCrumb(this);
    crumb->setFont(font);
    crumb->setFlat(false);
    crumb->addTab(tr("Mobile file list")); // Mobile file list手机文件列表
    crumb->addTab(tr("Mobile storage"));   // Mobile storage手机存储=======
    crumb->setMaximumWidth(CRUMB_MAXIMUM_WIDTH);

    // m_tabBarPath 需要设置标题栏的路径    类型： Mobile storage/图片/视频
    if (m_tabBarPath == "/") {
        crumb->setCurrentIndex(1);
    } else {
        QStringList fileName = m_tabBarPath.split("/");
        for (int i = 1; i < fileName.size(); i++) {
            crumb->addTab(fileName.value(i));
        }
        crumb->setCurrentIndex(fileName.size());
    }

    crumb->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

//    m_searchLine = new SearchEdit(this);
//    m_searchLine->hide();

//    m_searchButton = new QPushButton(this);
//    m_searchButton->setIcon(QIcon::fromTheme("system-search-symbolic"));
//    m_searchButton->setFixedSize(16, 16);
//    m_searchButton->setFlat(true);
//    m_searchButton->setCursor(Qt::PointingHandCursor);

//    m_editButton = new QPushButton(this);
//    m_editButton->setIcon(QIcon::fromTheme("document-edit-symbolic"));
//    m_editButton->setFixedSize(16, 16);
//    m_editButton->setFlat(true);
//    m_editButton->setCursor(Qt::PointingHandCursor);

//    m_verticalLineFrame = new QFrame(this);
//    m_verticalLineFrame->setFixedHeight(16);
//    m_verticalLineFrame->setFrameShape(QFrame::VLine);
//    m_verticalLineFrame->setFrameShadow(QFrame::Raised);
//    m_verticalLineFrame->setLineWidth(1);

    //模式
    m_modeButton = new QPushButton(this);
    m_modeButton->setIcon(QIcon::fromTheme("view-grid-symbolic"));
    m_modeButton->setToolTip(tr("List Mode")); // List Mode列表模式
    m_modeButton->setCursor(Qt::PointingHandCursor);
    m_modeButton->setFixedSize(20, 20);
    m_modeButton->setFlat(true);

    //刷新
    QPushButton *refreshButton = new QPushButton(this);
    refreshButton->setIcon(QIcon::fromTheme("view-refresh-symbolic"));
    refreshButton->setToolTip(tr("Refresh")); // Refresh刷新
    refreshButton->setCursor(Qt::PointingHandCursor);
    refreshButton->setFixedSize(20, 20);
    refreshButton->setFlat(true);

    fileListHLayout->addWidget(retreatButton);
    //    fileListHLayout->addWidget(forwardButton);
    //    fileListHLayout->addSpacing(28);
    fileListHLayout->addWidget(crumb);
    fileListHLayout->addStretch();
    //    fileListHLayout->addWidget(m_searchLine);
    //    fileListHLayout->addWidget(m_searchButton);
    //    fileListHLayout->addSpacing(20);
    //    fileListHLayout->addWidget(m_editButton);
    //    fileListHLayout->addSpacing(20);
    //    fileListHLayout->addWidget(m_verticalLineFrame);
    //    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(m_modeButton);
    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(refreshButton);
    fileListHLayout->setContentsMargins(68, 0, 68, 0);

    //列表项
    m_mobileStorageViewWidget = new MobileStorageViewWidget(m_listStruct);

    QWidget *listWidget = new QWidget();

    QVBoxLayout *scrollVLayout = new QVBoxLayout();
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(m_mobileStorageViewWidget);
    layout->addStretch();
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);

    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setWidgetResizable(true);

    //    m_scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->setFrameShape(QFrame::NoFrame);
    m_scrollArea->setWidget(listWidget);

    listWidget->setLayout(layout);

    scrollVLayout->addWidget(m_scrollArea);
    scrollVLayout->setContentsMargins(68, 0, 68, 10);

    mainVLayout->addLayout(fileListHLayout);
    mainVLayout->addSpacing(18);
    mainVLayout->addLayout(scrollVLayout);

    connect(retreatButton, &QPushButton::clicked, this, [=]() {
        int currentIndex = crumb->currentIndex();
        if (currentIndex > 0) {
            crumb->setCurrentIndex(currentIndex - 1);
        }
    });

    connect(refreshButton, &QPushButton::clicked, this, [=]() {
        for (int i = 2; i < crumb->currentIndex() + 1; i++) {
            m_currentIndexPath += "/" + crumb->tabText(i);
        }
        Q_EMIT sigUpdateClicked(m_currentIndexPath);
    });

//    connect(m_searchLine, &SearchEdit::sigEditFocusIn, this, [=]() {
//        setEditFocus(true);
//    });

//    connect(m_searchLine, &SearchEdit::sigEditFocusOut, this, [=]() {
//        setEditFocus(false);
//    });

//    connect(m_searchButton, &QPushButton::clicked, this, [=]() {
//        setEditFocus(true);
//    });

    connect(m_modeButton, &QPushButton::clicked, this, &MobileStorageWidget::slotModeButtonClicked);
    connect(crumb, &KBreadCrumb::currentChanged, this, [=](int index) {
        if (index >= 0) {
            QString indexText = crumb->tabText(index);
            if (index == 0 && indexText == tr("Mobile file list")) { // Mobile file list手机文件列表
                //设置显示连接成功后的界面
                slotHideCopyToComputerWidget();
                Q_EMIT sigShowMobileStorage();
                return;
            }

            if (index == 1 && indexText == tr("Mobile storage")) { // Mobile storage手机存储
                m_currentIndexPath = "/";
            }

            for (int i = crumb->count() - 1; i > index; i--) {
                crumb->removeTab(i);
            }

            for (int i = 2; i < crumb->currentIndex() + 1; i++) {
                m_currentIndexPath += "/" + crumb->tabText(i);
            }

            slotHideCopyToComputerWidget();

            //当前索引路径   刷新界面
            Q_EMIT sigCurrentIndexPath(m_currentIndexPath);
        }
    });

    initConnect();
}

void MobileStorageWidget::initPcUI()
{
    QVBoxLayout *mainVLayout = new QVBoxLayout();
    mainVLayout->setContentsMargins(0, 0, 0, 0);
    this->setLayout(mainVLayout);

    QHBoxLayout *fileListHLayout = new QHBoxLayout();

    m_copyButtonMobileStrorageWidget = new CopyToComputerButtonWidget(this);
    m_copyButtonMobileStrorageWidget->hide();

    QPushButton *retreatButton = new QPushButton(this);
    retreatButton->setIcon(QIcon::fromTheme("go-next-rtl-symbolic"));
    retreatButton->setFixedSize(16, 16);
    retreatButton->setFlat(true);
    retreatButton->setCursor(Qt::PointingHandCursor);

    //    QPushButton *forwardButton = new QPushButton(this);
    //    forwardButton->setIcon(QIcon::fromTheme("go-next-symbolic"));
    //    forwardButton->setFixedSize(16, 16);
    //    forwardButton->setFlat(true);
    //    forwardButton->setCursor(Qt::PointingHandCursor);

    QFont font;
    font.setBold(true);
    //面包屑
    KBreadCrumb *crumb = new KBreadCrumb(this);
    crumb->setFont(font);
    crumb->setFlat(false);
    crumb->setMaximumWidth(CRUMB_MAXIMUM_WIDTH);

    // m_tabBarPath 需要设置标题栏的路径    类型： Mobile storage/图片/视频
    QStringList fileName = m_tabBarPath.split("/");
    for (int i = 0; i < fileName.size(); i++) {
        crumb->addTab(fileName.value(i));
    }
    crumb->setCurrentIndex(fileName.size() - 1);

    //    m_searchLine = new SearchEdit(this);
    //    m_searchLine->hide();

    //    m_searchButton = new QPushButton(this);
    //    m_searchButton->setIcon(QIcon::fromTheme("system-search-symbolic"));
    //    m_searchButton->setFixedSize(16, 16);
    //    m_searchButton->setFlat(true);
    //    m_searchButton->setCursor(Qt::PointingHandCursor);

    //    m_editButton = new QPushButton(this);
    //    m_editButton->setIcon(QIcon::fromTheme("document-edit-symbolic"));
    //    m_editButton->setFixedSize(16, 16);
    //    m_editButton->setFlat(true);
    //    m_editButton->setCursor(Qt::PointingHandCursor);

    //    m_verticalLineFrame = new QFrame(this);
    //    m_verticalLineFrame->setFixedHeight(16);
    //    m_verticalLineFrame->setFrameShape(QFrame::VLine);
    //    m_verticalLineFrame->setFrameShadow(QFrame::Raised);
    //    m_verticalLineFrame->setLineWidth(1);

    //模式
    m_modeButton = new QPushButton(this);
    m_modeButton->setIcon(QIcon::fromTheme("view-grid-symbolic"));
    m_modeButton->setToolTip(tr("List Mode")); // List Mode列表模式
    m_modeButton->setCursor(Qt::PointingHandCursor);
    m_modeButton->setFixedSize(20, 20);
    m_modeButton->setFlat(true);

    //刷新
    QPushButton *refreshButton = new QPushButton(this);
    refreshButton->setIcon(QIcon::fromTheme("view-refresh-symbolic"));
    refreshButton->setToolTip(tr("Refresh")); // Refresh刷新
    refreshButton->setCursor(Qt::PointingHandCursor);
    refreshButton->setFixedSize(20, 20);
    refreshButton->setFlat(true);

    fileListHLayout->addWidget(retreatButton);
    fileListHLayout->addSpacing(20);
    //    fileListHLayout->addWidget(forwardButton);
    //    fileListHLayout->addSpacing(28);
    fileListHLayout->addWidget(crumb);
    fileListHLayout->addStretch();
    //    fileListHLayout->addWidget(m_searchLine);
    //    fileListHLayout->addWidget(m_searchButton);
    //    fileListHLayout->addSpacing(20);
    //    fileListHLayout->addWidget(m_editButton);
    //    fileListHLayout->addSpacing(20);
    //    fileListHLayout->addWidget(m_verticalLineFrame);
    //    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(m_modeButton);
    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(refreshButton);
    fileListHLayout->setContentsMargins(68, 0, 68, 0);

    //列表项
    m_mobileStorageViewWidget = new MobileStorageViewWidget(m_listStruct);

    QWidget *listWidget = new QWidget();

    QVBoxLayout *scrollVLayout = new QVBoxLayout();
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(m_mobileStorageViewWidget);
    layout->addStretch();
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);

    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setWidgetResizable(true);

    //    scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->setFrameShape(QFrame::NoFrame);
    m_scrollArea->setWidget(listWidget);

    listWidget->setLayout(layout);

    scrollVLayout->addWidget(m_scrollArea);
    scrollVLayout->setContentsMargins(68, 0, 68, 10);

    mainVLayout->addLayout(fileListHLayout);
    mainVLayout->addSpacing(18);
    mainVLayout->addLayout(scrollVLayout);

    connect(retreatButton, &QPushButton::clicked, this, [=]() {
        int currentIndex = crumb->currentIndex();
        if (currentIndex > 0) {
            crumb->setCurrentIndex(currentIndex - 1);
        }
    });

    connect(refreshButton, &QPushButton::clicked, this, [=]() {
        for (int i = 2; i < crumb->currentIndex() + 1; i++) {
            m_currentIndexPath += "/" + crumb->tabText(i);
        }
        Q_EMIT sigUpdateClicked(m_currentIndexPath);
    });

//    connect(m_searchLine, &SearchEdit::sigEditFocusIn, this, [=]() {
//        setEditFocus(true);
//    });

//    connect(m_searchLine, &SearchEdit::sigEditFocusOut, this, [=]() {
//        setEditFocus(false);
//    });

//    connect(m_searchButton, &QPushButton::clicked, this, [=]() {
//        setEditFocus(true);
//    });

    connect(m_modeButton, &QPushButton::clicked, this, &MobileStorageWidget::slotModeButtonClicked);
    connect(crumb, &KBreadCrumb::currentChanged, this, [=](int index) {
        if (index >= 0) {
            //            if (index == 0) {
            //                return;
            //            }

            for (int i = crumb->count() - 1; i > index; i--) {
                crumb->removeTab(i);
            }
            m_currentIndexPath = crumb->tabText(0);
            for (int i = 1; i < crumb->currentIndex() + 1; i++) {
                m_currentIndexPath += "/" + crumb->tabText(i);
            }

            slotHideCopyToComputerWidget();

            //当前索引路径   刷新界面
            Q_EMIT sigCurrentIndexPath(m_currentIndexPath);
        }
    });
    initConnect();
}

void MobileStorageWidget::initConnect()
{
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigFileName, this, &MobileStorageWidget::slotFileName);
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigHideCopyToComputerWidget, this,
            &MobileStorageWidget::slotHideCopyToComputerWidget);
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigShowCopyButton, this,
            &MobileStorageWidget::slotShowCopyButtonWidget);
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigSelectDataList, this,
            [=](const QList<FileInfo> &fileList) {
                m_copyButtonMobileStrorageWidget->getSelectDataList(fileList);
            });
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigLocalPathList, this,
            &MobileStorageWidget::slotLocalPathList);
    connect(m_mobileStorageViewWidget, &MobileStorageViewWidget::sigMenuFileName, this,
            &MobileStorageWidget::slotMenuFileName);
    connect(m_copyButtonMobileStrorageWidget, &CopyToComputerButtonWidget::sigChooseFilePath, this,
            &MobileStorageWidget::sigChooseFilePath);
    connect(this, &MobileStorageWidget::sigViewHeight, m_mobileStorageViewWidget, [=]() {
        m_mobileStorageViewWidget->setViewHeight();
    });
}

void MobileStorageWidget::setEditFocus(bool focus)
{
//    if (focus == true) {
//        m_searchButton->hide();
//        m_editButton->hide();
//        m_verticalLineFrame->hide();
//        m_searchLine->show();
//        m_searchLine->setFocus();
//    } else {
//        m_searchButton->show();
//        m_editButton->show();
//        m_verticalLineFrame->show();
//        m_searchLine->hide();
//        m_searchLine->clearFocus();
//    }
}

void MobileStorageWidget::slotShowCopyButtonWidget()
{
    if (m_copyButtonMobileStrorageWidget->isVisible()) {
        moveCopyToComputerWidget();
    } else {
        moveCopyToComputerWidget();
        m_copyButtonMobileStrorageWidget->show();
        m_copyButtonMobileStrorageWidget->raise();
    }
}

void MobileStorageWidget::slotHideCopyToComputerWidget()
{
    if (m_copyButtonMobileStrorageWidget->isVisible()) {
        m_copyButtonMobileStrorageWidget->hide();
    }
}

void MobileStorageWidget::moveCopyToComputerWidget()
{
    m_copyButtonMobileStrorageWidget->move(QPoint(this->width() / 2 - m_copyButtonMobileStrorageWidget->width() / 2,
                                                  this->height() - 16 - m_copyButtonMobileStrorageWidget->height()));
}

void MobileStorageWidget::slotModeButtonClicked()
{
    // 切换视图埋点
    GenerateTools::buriedPoint(kabase::BuriedPoint::PT::KylinMobileAssistantSwitchView);
    switch (m_mode) {
    case QListView::IconMode:
        m_mode = QListView::ListMode;
        m_modeButton->setIcon(QIcon::fromTheme("view-list-symbolic"));
        m_modeButton->setToolTip(tr("Icon Mode")); // Icon Mode图标模式
        break;
    case QListView::ListMode:
        m_mode = QListView::IconMode;
        m_modeButton->setIcon(QIcon::fromTheme("view-grid-symbolic"));
        m_modeButton->setToolTip(tr("List Mode")); // List Mode列表模式
        break;
    default:
        break;
    }
    m_mobileStorageViewWidget->setMode(m_mode);
    Q_EMIT sigModeChange(m_mode);
}

void MobileStorageWidget::slotFileName(QString fileNamePath)
{
    if (m_tabBarPath == "/") {
        fileNamePath = m_tabBarPath + fileNamePath;
    } else {
        fileNamePath = m_tabBarPath + "/" + fileNamePath;
    }
    Q_EMIT sigFileName(fileNamePath);
}

void MobileStorageWidget::slotLocalPathList(const QStringList &localPathList)
{
    Q_EMIT sigLocalPathList(localPathList);
}

void MobileStorageWidget::slotMenuFileName(QString fileName)
{
    Q_EMIT sigMenuFileName(fileName);
}

void MobileStorageWidget::initSearchUI()
{
    QVBoxLayout *mainVLayout = new QVBoxLayout();

    QHBoxLayout *fileListHLayout = new QHBoxLayout();

    m_copyButtonMobileStrorageWidget = new CopyToComputerButtonWidget(this);
    m_copyButtonMobileStrorageWidget->hide();

    //返回键
    QPushButton *retreatButton = new QPushButton(this);
    //    retreatButton->setIcon(QIcon(":/image/retreat.png"));
    retreatButton->setFixedSize(16, 16);
    retreatButton->setFlat(true);
    retreatButton->setCursor(Qt::PointingHandCursor);
    retreatButton->setStyleSheet("QPushButton{border-image:url(:/png/image/retreat.png);}");

    QString searchResult =
        QString(tr("Search out %1 Results")).arg(m_listStruct.size()); // Search out %1 Results搜索%1个结果
    QFont font;
    font.setBold(true);
    //面包屑
    KBreadCrumb *crumb = new KBreadCrumb(this);
    crumb->setFont(font);
    crumb->setFlat(false);
    crumb->addTab(searchResult);
    crumb->setMaximumWidth(700);

    //模式
    m_modeButton = new QPushButton(this);
    m_modeButton->setIcon(QIcon(":/icon/icon_mode.png"));
    m_modeButton->setToolTip(tr("List Mode")); // List Mode列表模式
    m_modeButton->setCursor(Qt::PointingHandCursor);
    m_modeButton->setFixedSize(20, 20);
    m_modeButton->setFlat(true);

    //刷新
    QPushButton *refreshButton = new QPushButton(this);
    refreshButton->setIcon(QIcon(":/icon/refresh.png"));
    refreshButton->setToolTip(tr("Refresh")); // Refresh刷新
    refreshButton->setCursor(Qt::PointingHandCursor);
    refreshButton->setFixedSize(20, 20);
    refreshButton->setFlat(true);

    fileListHLayout->addWidget(retreatButton);
    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(crumb);
    fileListHLayout->addStretch();
    fileListHLayout->addWidget(m_modeButton);
    fileListHLayout->addSpacing(20);
    fileListHLayout->addWidget(refreshButton);
    fileListHLayout->setMargin(0);
    fileListHLayout->setContentsMargins(68, 0, 68, 0);

    //列表项
    m_mobileStorageViewWidget = new MobileStorageViewWidget(m_listStruct);

    QWidget *listWidget = new QWidget();

    QVBoxLayout *scrollVLayout = new QVBoxLayout();
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(m_mobileStorageViewWidget);
    layout->addStretch();
    layout->setSpacing(0);
    layout->setMargin(0);

    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setWidgetResizable(true);

    m_scrollArea->setFrameShape(QFrame::NoFrame);
    m_scrollArea->setWidget(listWidget);

    listWidget->setLayout(layout);

    scrollVLayout->addWidget(m_scrollArea);
    scrollVLayout->setContentsMargins(68, 0, 68, 10);

    mainVLayout->addLayout(fileListHLayout);
    mainVLayout->addSpacing(18);
    mainVLayout->addLayout(scrollVLayout);
    mainVLayout->setSpacing(0);
    mainVLayout->setMargin(0);
    this->setLayout(mainVLayout);

    connect(retreatButton, &QPushButton::clicked, this, [=]() {
        qInfo() << "search retreat clicked";
        Q_EMIT sigSetLastWidget();
    });

    connect(refreshButton, &QPushButton::clicked, this, [=]() {
        Q_EMIT sigUpdateClicked("Search");
    });
    connect(m_modeButton, &QPushButton::clicked, this, &MobileStorageWidget::slotModeButtonClicked);
    initConnect();
}

void MobileStorageWidget::setViewHeight()
{
    Q_EMIT sigViewHeight();
    if (m_copyButtonMobileStrorageWidget) {
        moveCopyToComputerWidget();
    }
}

void MobileStorageWidget::setTheme(PublicAttributes::Theme theme)
{
    if (theme == PublicAttributes::Theme::Light) {
        QPalette scrollPalette = m_scrollArea->palette();
        scrollPalette.setColor(QPalette::Base, QColor("#FFFEFD"));
        m_scrollArea->setPalette(scrollPalette);
    } else if (theme == PublicAttributes::Theme::Dark) {
        QPalette scrollPalette = m_scrollArea->palette();
        scrollPalette.setColor(QPalette::Base, QColor("#1D1D1D"));
        m_scrollArea->setPalette(scrollPalette);
    }
}
